import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { List, Icon } from 'antd-mobile';
import content from '../../../common/contentCss/content.css';
import CustTitle from '../../../common/title/title';
import MyPointView from './pages/myPoint';

const listItem = {"birthday":"1983-05-07 00:00:00","vipValidDate":"2017-10-28 14:52:23","serviceArea":"接待,证道,传福音,关怀","decissionTime":"1988-01-01 00:00:00","church":"广州天河堂","verified":2,"maskAvatar":"http://112.74.26.228:8000/876708082437197824/b1cdcb82-5c82-465e-9fc4-d39bdc3c0da8.png","avatar":"http://112.74.26.228:8000/876708082437197824/83d1112c-00fe-49ca-b634-d392717ec7e3.png","mediatorId":"912867046123110401","type":1,"vipLevel":2,"baptized":"1996-01-01 00:00:00","lastLoginTime":"2017-10-14 16:43:27","u_id":"123467","createTime":"2017-09-27 10:13:27","name":"高新领队招募","id":"912862718893228034","followerCount":0,"loveStatus":2}



function MyPoint({dispatch,loading,myPoint}) {
  const { selectedIndex,billNavIndex } = myPoint
  const titleProps = {
    titleName:'我的积分',
    showSaveBtnStatus: true,
    saveBtnName: '设置',
    goBack(){
      history.go(-1);
    },
    onSave(){
      // console.log('我的钱包----设置')
      dispatch(routerRedux.push({
        pathname: '/set-my-point',
      }));
    },
  }

  const myPointProps = {
    selectedIndex,
    billNavIndex,
    onSelected(selectedIndex){
      console.log(selectedIndex);
      dispatch({
        type:'myPoint/querySuccess',
        payload:{
          selectedIndex
        }
      })
    },
    onbillNav(billNavIndex) {
      console.log('billNavIndex2');
      console.log(billNavIndex);
      dispatch({
        type:'myPoint/querySuccess',
        payload:{
          billNavIndex
        }
      })
    }
  }

  const MarginHeight = () => <div style={{height: '0.6em', backgroundColor:'#F5F5F9'}}></div>;

  return(
    <div className={content.content}>
      <CustTitle {...titleProps}/>
      <div style={{
        marginTop: '2.8125em',
      }}>
      </div>
      <MyPointView {...myPointProps}/>
    </div>
  )
}

function mapStateToProps(state, ownProps) {
  return {
    myPoint:state.myPoint,
  }
}

export default connect(mapStateToProps)(MyPoint);
